package com.tanhua.manager.service.impl;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tanhua.manager.mapper.QuestionSoulMapper;
import com.tanhua.manager.service.QuestionSoulService;
import com.tanhua.pojo.QuestionSoul;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;



@Service
public class QuestionSoulServiceImpl extends ServiceImpl<QuestionSoulMapper, QuestionSoul> implements QuestionSoulService {

    @Autowired
    private QuestionSoulMapper questionMapper;

    @Override
    public IPage<QuestionSoul> findByPage(Integer pageNum, Integer pageSize) {

        IPage<QuestionSoul> page = new Page<>(pageNum,pageSize);

        return questionMapper.selectPage(page,null);
    }

    @Override
    public Boolean insertOne(QuestionSoul question) {
        int insert = questionMapper.insert(question);
        return insert > 0;
    }

    @Override
    public Boolean removeManyById(String nums) {
        String[] numLs = nums.split(",");
        try {
            for (String numL : numLs) {
                questionMapper.deleteById(numL);
            }
            return true;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return false;
    }
}
